<?php

namespace App\Controller;

use Common\Controller\BaseController;

/**
 * 图形验证码
 * @package App\Controller
 */
class ImgCodeController extends BaseController
{
    private $conf = array(
        'expire' => 3600,
        'useNoise' => false,
        'fontSize' => 17,
        'imageW' => 88,
        'imageH' => 35,
        'length' => 3,
        'bg' => array(240, 240, 240),
    );

    /**
     * 生成图形验证码
     * @param string $mark
     */
    public function verityEntry($mark = '')
    {
        ob_clean();
        $verify = new \Think\Verify($this->conf);
        $verify->entry($mark);
    }

    /**
     * 验证图形验证码
     * @param $code
     * @param string $mark
     * @return bool
     */
    public function verityCheck($code, $mark = '')
    {
        $verify = new \Think\Verify($this->conf);
        return $verify->check($code, $mark);
    }

}
